


import { getCityApi } from '../Api'
import { debounce,  } from '../utils/utilsFn'


export default {
    data: {
        inputValue: "",
        handler:undefined,
        citys:[]
    },
    onReady() {
        this.handler = debounce(this.getCitysData,500)
    },
    async  getCitysData(val){

        const {result}=await  getCityApi(val);
        const data=JSON.parse(result).districts
        this.citys=data
        console.log(JSON.stringify(data))
        this.$emit("changeWeatherData", {
            data:data
        })
    },
   changeInput(val){

      this.handler(val.value)

    },


}



